/*
 * @Author: your name
 * @Date: 2020-05-09 08:54:07
 * @LastEditTime: 2020-05-09 11:33:01
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \knowledge\js\es6.js
 */
// /*
//  * @Author: your name
//  * @Date: 2020-05-09 08:54:07
//  * @LastEditTime: 2020-05-09 09:02:20
//  * @LastEditors: Please set LastEditors
//  * @Description: In User Settings Edit
//  * @FilePath: \knowledge\js\es6.js
//  */
// // import _ from 'lodash'
let _ =  require('lodash')

let list = [{name:"dovey",id:1},{name:"dovey",id:2},{name:"lida",id:3}]

let gruobyList = _.groupBy(list,'name');

console.log(gruobyList)

let countBy = _.countBy(list,'name');
console.log(countBy)

// let arrayList = _.countBy(list,'name')//_.castArray(countBy);
// console.log(arrayList);

var arr = []
for (let i in countBy) {
    let o = {};
	o[i] = countBy[i];
	arr.push(o)
}
console.log(arr);



//  let list = [{name:'dovey',id:2},{name:'dovey1',id:1}]

//  let nList = [...list];
//  console.log(list)
//  console.log(nList)

//  console.log(list === nList)
//  console.log(list[0] === nList[0])
// //  list[0]

// let nlist2 = _.cloneDeep(list);

// console.log(list)
// console.log(nlist2)

// console.log(list === nlist2)
// console.log(list[0] === nlist2[0])

